package com.hermit.qmst.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hermit.qmst.R;
import com.hermit.qmst.mode.PayItem;

import java.util.List;

/**
 * Created by hermithermit on 16/6/21.
 */
public class PayListAdapter extends BaseAdapter {

    private Context mContext;
    private List<PayItem> mList;


    public PayListAdapter(Context context,List<PayItem> list){
        mContext = context;
        mList = list;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if (convertView == null){
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_paylist,null);

        }

        TextView textView = (TextView)convertView.findViewById(R.id.tv_body);

        PayItem item = mList.get(position);
        textView.setText(item.getBody());

        convertView.setTag(textView);


        return convertView;
    }
}
